package ar.uba.fi.algo3.algoTank.Objetos;

import java.io.Serializable;

public class Posicion implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID =51L;
	private float x;
	private float y;

	public Posicion(float valorX, float valorY ){
		
		this.x = valorX;
		this.y =valorY;
	}
	
	public Posicion(){
	}
	
	public void setX(float valorX){
		this.x = valorX;
		
	}
	public void setY(float valorY){
		this.y = valorY;
		
	}
	
	public float getX(){
		return x;
	}
	
	public float getY(){
		return this.y;
	}
	
	public float moduloX() {
		float modulo = x;
		if (x<0)
			modulo = modulo* (-1);
		return modulo;
	}
	
	public float moduloY() {
		float modulo = y;
		if (y<0)
			modulo = modulo* (-1);
		return modulo;
	}
	
	public Posicion restar(Posicion posicion) {
		Posicion newpos = new Posicion();
		newpos.setX(this.getX() - posicion.getX());
		newpos.setY(this.getX() - posicion.getY());
		return newpos;		
	}

	
}
